<?php
namespace Home\Controller;
use Think\Controller;
class CatController extends Controller {
    public function cat(){
		$goodsModel = D('Admin/goods');
		$count = $goodsModel->field('goods_id,goods_name,shop_price,goods_img,market_price')->where('cat_id='.I('cat_id'))->count();
		$page = new\Think\Page($count,5); 
		$show = $page->show();

		                             //I('cat_id')为接收地址栏的传参
		$goodsList = $goodsModel->field('goods_id,goods_name,shop_price,goods_img,market_price')->where('cat_id='.I('cat_id'))->limit($page->firstRow.','.$page->listRows)->select();  	   
   	    $this->assign('count',$count);
   	    $this->assign('goodslist',$goodsList);
   	    $this->assign('page',$show);
   	    $this->display();
    }
}